<%--
 *  File:    ClearMasterData.jsp
 *  @Author: visaZhou
 *  Date:    2009/11/11
 *
 *  Copyright (C) 2000 - 2002 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="java.text.*"%>
<%@ page import="org.apache.log4j.Category" %>
<%@ page import="com.oval.util.*" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>


<% //--------------------------------------  setting logger --%>


<% //--------------------------------------  variant and initialization --%>
<%
	String strModuleName = "COM";
 	String strTableName = "v_zylcleanmaster";
	String privilegeCode = "11501";    
    String contextPath = request.getContextPath(); 
%>

<% //--------------------------------------  include files list --%>

<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/FrmDefault.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>
<%@ include file="/rpt/ReportURL.inc" %>

<html>
<head>
<title>ClearMasterData</title>
<PageFlow:CheckPageFlow pageName="p_runningprocedurestate"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath %>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath %>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/FuncLib.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/ScriptLib.js"></script>

<%@ include file="/inc/SummaryDivision.inc" %>

<% //--------------------------------------  output variant from pageflow --%>
<%
  	Vector totalsummary = (Vector)pageContext.getAttribute("totalsummary");
  	if(totalsummary == null)
  	{
  		totalsummary = new Vector();
  	}
    String baseerrorflag = (String)pageContext.getAttribute("baseerrorflag");
    if(baseerrorflag == null) baseerrorflag = new String("");

    String emperrorflag = (String)pageContext.getAttribute("emperrorflag");
    if(emperrorflag == null) emperrorflag = new String("");
    
    String doctorerrorflag = (String)pageContext.getAttribute("doctorerrorflag");
    if(doctorerrorflag == null) doctorerrorflag = new String("");


    String dsorgerrorflag = (String)pageContext.getAttribute("dsorgerrorflag");
    if(dsorgerrorflag == null) dsorgerrorflag = new String("");

    String hporgerrorflag = (String)pageContext.getAttribute("hporgerrorflag");
    if(hporgerrorflag == null) hporgerrorflag = new String("");

    String drorgerrorflag = (String)pageContext.getAttribute("drorgerrorflag");
    if(drorgerrorflag == null) drorgerrorflag = new String("");
    
    String dcorgerrorflag = (String)pageContext.getAttribute("dcorgerrorflag");
    if(dcorgerrorflag == null) dcorgerrorflag = new String("");
   


%>

<script language="JavaScript" >
function page_summary(actionvalue,orderbyname){
  	 var editform = summaryPrepare(cform,actionvalue,orderbyname);
 	 editform.action = "ClearMasterData.jsp?<%= OvalTools.randomURL() %>";
 	setTimeout("page_summary(actionvalue,orderbyname);","5000");
 	 editform.target = "_self";
 	 isRunning = true;
 	 editform.submit();
 		
}

function page_do(){
	
	 cform.actionname.value = "clear";
  	 cform.target = "_self";
  	 isRunning = true;
  	 cform.submit();
}

function page_export(code){

  if(code == "112" || code == "113" || code == "114" || code == "116")
  {
     if(code == "112")
    {var url1 = "<%=reportURL%>/servlet/ExcecuteReport/Distributor_error.sox?__format=xlsx&__folder=/ovalreport&globalpccode=112";
	 	var strstatus="height=768, width=1024,top=0,left=0,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no";
    popwindow = window.open(url1, "n1window", strstatus);
     }
     if(code == "113")
    {var url1 = "<%=reportURL%>/servlet/ExcecuteReport/hporginfo_error.sox?__format=xlsx&__folder=/ovalreport&globalpccode=113";
	 	var strstatus="height=768, width=1024,top=0,left=0,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no";
    popwindow = window.open(url1, "n1window", strstatus);
     }
    if(code == "114")
    {var url1 = "<%=reportURL%>/servlet/ExcecuteReport/dsinfo_error.sox?__format=xlsx&__folder=/ovalreport&globalpccode=114";
	 	var strstatus="height=768, width=1024,top=0,left=0,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no";
    popwindow = window.open(url1, "n1window", strstatus);
     }
    if(code == "116")
    {var url1 = "<%=reportURL%>/servlet/ExcecuteReport/dcinfo_error.sox?__format=xlsx&__folder=/ovalreport&globalpccode=116";
	 	var strstatus="height=768, width=1024,top=0,left=0,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no";
    popwindow = window.open(url1, "n1window", strstatus);
     }
    }
  else
   {
       if(code == "base")
    {var url1 = "<%=reportURL%>/servlet/ExcecuteReport/clear_mastdata_error.sox?__format=xlsx&__folder=/ovalreport";
	 	var strstatus="height=768, width=1024,top=0,left=0,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no";
    popwindow = window.open(url1, "n1window", strstatus);
     }
     if(code == "employee")
    {var url1 = "<%=reportURL%>/servlet/ExcecuteReport/employee_error.sox?__format=xlsx&__folder=/ovalreport&orgid=1001";
	 	var strstatus="height=768, width=1024,top=0,left=0,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no";
    popwindow = window.open(url1, "n1window", strstatus);;
     }
     if(code == "doctor")
     {var url1 = "<%=reportURL%>/servlet/ExcecuteReport/DoctorCollateData.sox?__format=xlsx&__folder=/ovalreport";
 	 	var strstatus="height=768, width=1024,top=0,left=0,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no";
     popwindow = window.open(url1, "n1window", strstatus);;
      }
     
      if(code == "other")
    {var url1 = "<%=reportURL%>/servlet/ExcecuteReport/clear_othererror.sox?__format=xlsx&__folder=/ovalreport";
	 	var strstatus="height=768, width=1024,top=0,left=0,toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, status=no";
    popwindow = window.open(url1, "n1window", strstatus);
     }
   }


}
function page_default(){
	var datahandler = new  DataHandler() ;
	   
	datahandler.add_job("j_runningprocedurestate");
	
	datahandler.runDataHandler();
	history.go(0);
}

function page_settimeout(){
	//setTimeout("page_summary(actionvalue,orderbyname);","5000");
	//document.getElementById("checkajax").innerHTML = "<font size=\"2\" id=\"checkajax\">&nbsp;&nbsp;&nbsp;正在加载中，请耐心等待...  </font><img src='<%= contextPath %>/images/<%= strLanguageCode %>/loadinglit.gif' >";
				
	
	window.reload(setTimeout("page_default();","10000"));
	//alert();
	//setTimeout("page_settimeout();","5000")
 }



</script>

</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" >
<iframe id="reloadHandler" name="reloadHandler" style="display:none"></iframe>
<form name="cform" method="post" action="<%=contextPath %>/Dispatcher">
<input type="hidden" name="pagename" value="p_runningprocedurestate">
<input type="hidden" name="actionname">

<%@ include file="/inc/PageLocation.inc" %>

<table width="100%" cellspacing="0" cellpadding="0" border="0">
      <tr>
        <td>
          <table width="100%" border="0" cellspacing="0">
            <%@ include file="/inc/SummarySearch.inc" %>
          </table>
        </td>
      </tr>
</table>
<table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
        <tr class="deepblue-left">
        <td class="title_center" width="4%"><a href="javascript:page_summary('orderby','seqno')"><%= label.getLabelName("L_Sequence") %></a></td>
          <td class="title_center" width="5%"><a href="javascript:page_summary('orderby','configcode')"><%= label.getLabelName("L_GroupNumber") %></a></td>
          <td class="title_center" width="15%"><a href="javascript:page_summary('orderby','configname')"><%= label.getLabelName("L_Name") %></a></td>
          <td class="title_center" width="25%"><a href="javascript:page_summary('orderby','descr')"><%= label.getLabelName("L_Description") %></a></td>
          <td class="title_center" width="10%"><a href="javascript:page_summary('orderby','begintime')"><%= label.getLabelName("L_StartTime") %></a></td>
          <td class="title_center" width="10%"><a href="javascript:page_summary('orderby','endtime')"><%= label.getLabelName("L_EndTime") %></a></td>
          <td class="title_center" width="3%"><a href="javascript:page_summary('orderby','lastrunmsg')"><%= label.getLabelName("L_Information") %></a></td>
          <td class="title_center" width="3%"><a href="javascript:page_summary('orderby','valuename')"><%= label.getLabelName("L_StatusName") %></a></td>
          <td class="title_center" width="5%"><a href="javascript:page_summary('orderby','runstatus')"><%= label.getLabelName("L_RunResult") %></a></td>
          <td class="title_center" width="5%"><a href="javascript:page_summary('orderby','runstatus')"><%= label.getLabelName("L_Flag") %></a></td>
          
        </tr>
		 <% //--------------------------------------  default value definition --%>
          	<%
            	int i = 0;
             	String strClassType = new String();
          	%>

          	<% //--------------------------------------  loop results --%>
		<logic:iterate id="onerow" collection="<%= totalsummary %>" indexId="idx">
           	<%
            	HashMap tempMap = (HashMap)pageContext.getAttribute("onerow");
            	if(i%2 == 1)
            	{
              		strClassType = "td-listrom";
            	}else{
              		strClassType = "";
            	}
            	i++;
            	SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        		HashMap  myrow=(HashMap)onerow;
        		String displayStartDate;
        		if(myrow.get("begintime") ==null){
        			displayStartDate = "";
        			
        		}else {
        		
            	Date startdate=((Date)myrow.get("begintime"));
            	 displayStartDate = sdf.format(startdate);
        		}
        		String displayEndDate; 
        		if (myrow.get("endtime") == null) {
        			displayEndDate="";
        			
        		}else {
            		Date enddate=((Date)myrow.get("endtime"));
            	 	displayEndDate = sdf.format(enddate);
            	 }
          	%>
          	<tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull( strClassType )%>'"  class="none">
          		<td class="title_center">
					<custom:write name="onerow" property="seqno"  nbsp="true"/>
				</td>
				<td class="title_center">
				<a href="zylClearinfo.jsp?<%= OvalTools.randomURL() %>&nconfigcode=<%=JspHelper.filterNull( tempMap.get("configcode") )%>"><%=JspHelper.filterNull( tempMap.get("configcode") )%></a>
				</td>
				<td class="title_center">
					<custom:write name="onerow" property="configname"  nbsp="true"/>
				</td>    
          		<td>
              		<custom:write name="onerow" property="descr"  nbsp="true"/>
            	</td>
            	<td class="title_center">&nbsp;<%=displayStartDate %>
            	</td>
            	<td class="title_center">&nbsp;<%=displayEndDate %>
            	</td>
				<td class="title_center">
					<custom:write name="onerow" property="lastrunmsg"  nbsp="true"/>
				</td>    
				<td class="title_center">
					<custom:write name="onerow" property="valuename"  nbsp="true"/>
				</td>
				<td class="title_center">
					<custom:write name="onerow" property="runstatus"  nbsp="true"/>
				</td>
				<td class="title_center">
					<custom:write name="onerow" property="erraction"  nbsp="true"/>
				</td>
     		 </tr>
     	 </logic:iterate>
      
       <%@ include file="/inc/SummaryAction.inc" %>
     <table width="100%" cellspacing="0" cellpadding="0">
        <tr>
          <td class="summary_top"></td>
        </tr>
        <tr>
          <td class="td_center">
		  	<a onclick="page_do()"><custom:button type="1" label="L_DataClean" imgsrc="add.gif" border="0" style="width:100" privilegeCode="11501MB-SJQL01"/></a>

          </td>
        </tr>
          <tr>
          <td>&nbsp;</td>
        </tr>
         <tr>
          <td class="td_center">

            <%if(baseerrorflag.equals("Y")){%>
              <a onclick="page_export('other')"><custom:button type="1"  label="L_BaseErrorExport" imgsrc="edit.gif" border="0" style="width:150" privilegeCode="11501MB-SJQL05"/></a>
           <%}%>
            <%if(emperrorflag.equals("Y")){%>
            <a onclick="page_export('employee')"><custom:button type="1"  label="L_EmployeeErrorExport" imgsrc="edit.gif" border="0" style="width:150" privilegeCode="11501MB-SJQL06"/></a>
           <%}%>
              <%if(doctorerrorflag.equals("Y")){%>
            <a onclick="page_export('doctor')"><custom:button type="1"  label="L_DoctorErrorExport" imgsrc="edit.gif" border="0" style="width:150" privilegeCode="11501MB-SJQL06"/></a>
           <%}%>
            <%if(dsorgerrorflag.equals("Y")){%>
            <a onclick="page_export('112')"><custom:button type="1"  label="L_DistributorErrorExport" imgsrc="edit.gif" border="0" style="width:150" privilegeCode="11501MB-SJQL02"/></a>
            <%}%>
            <%if(hporgerrorflag.equals("Y")){%>
              <a onclick="page_export('113')"><custom:button type="1"  label="L_HporginfoErrorExport" imgsrc="edit.gif" border="0" style="width:150" privilegeCode="11501MB-SJQL03"/></a>
            <%}%>
            <%if(drorgerrorflag.equals("Y")){%>
              <a onclick="page_export('114')"><custom:button type="1"  label="L_DsinfoErrorExport" imgsrc="edit.gif" border="0" style="width:150" privilegeCode="11501MB-SJQL04"/></a>
            <%}%>
            <%if(dcorgerrorflag.equals("Y")){%>
              <a onclick="page_export('116')"><custom:button type="1"  label="L_DcinfoErrorExport" imgsrc="edit.gif" border="0" style="width:150" privilegeCode="11501MB-SJQL07"/></a>
            <%}%>
          </td>
        </tr>
     </table>
</table>
</form>
</body>
</html>